﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;

namespace XMLparsingExercise
{
    class Person
    {
        private string name;
        private string phone;
        private string address;

        public Person(string name, string phone, string address)
        {
            this.name = name;
            this.phone = phone;
            this.address = address;
        }

        public string Name
        {
            get
            {
                return name;
            }
            set
            {
                name = value;
            }
        }

        public string Phone
        {
            get
            {
                return phone;
            }
            set
            {
                phone = value;
            }
        }

        public string Address
        {
            get
            {
                return address;
            }
            set
            {
                address = value;
            }
        }

        public static List<Person> GetSampleList()
        {
            List<Person> list = new List<Person>()
            {
                new Person("Pesho", "0896333", "sofia, bg"),
                new Person("Gosho", "123456", "razgrad, bg"),
                new Person("Tosho", "23456765", "Paris, bg"),
                new Person("ivan", "654345", "New York, US"),
                new Person("polina", "45654", "telerik, bg"),
                new Person("anna", "0896333", "bora bora, po"),
            };

            return list;
        }

        public void WritePerson(XmlWriter writer)
        {
            writer.WriteStartElement("person");
            writer.WriteElementString("name", this.name);
            writer.WriteElementString("phone", this.phone);
            writer.WriteElementString("address", this.address);
            writer.WriteEndElement();
        }
    }
}
